import { ref } from "vue"

/**
 * 加载状态
 * 
 * @returns {
 *    startLoading: 开启加载
 *    closeLoading: 关闭加载
 *    loading:      加载状态
 * }
 */
export function useLoading() {

  let loading = ref(false)

  const startLoading = () => {
    loading.value = true
  }

  const closeLoading = () => {
    loading.value = false
  }

  return {
    startLoading,
    closeLoading,
    loading
  }
}
